Vue.component("like", {
  template: '#like-component-tpl',
  data: function() {
    return {
      name: '赞',
      like_count: 10,
      liked: false
    }
  },
  methods: {
    toggle_like: function() {
      if (!this.liked) {
        this.like_count++;
        this.name = "踩";
      } else {
        this.like_count--;
        this.name = "赞";
      }
      this.liked = !this.liked;
    }
  }
})

new Vue({
  el: '#app'
})
